import sys
import os
import getpath
from PyQt5 import QtWidgets, QtCore
from PyQt5.QtGui import QPalette,QColor
import traceback
import logging
from logging.handlers import RotatingFileHandler
# import mystyle
sys.stdout = open(sys.stdout.fileno(), mode='w', encoding='utf8', buffering=1)
sys.stderr = open(sys.stderr.fileno(), mode='w', encoding='utf8', buffering=1)
handlers=[RotatingFileHandler(filename="report.log", maxBytes=10*1024*1024, encoding='utf-8',backupCount=3),logging.StreamHandler(sys.stdout)]
logging.basicConfig(level=logging.DEBUG,
                    format = '%(asctime)s - %(name)s - %(levelname)s -%(funcName)s - %(message)s',
                    handlers=handlers)
logging.info('begin')
logging.getLogger('matplotlib').setLevel(logging.WARNING)
logging.getLogger("PIL").setLevel(logging.WARNING)
def main():
    from mainw import MainW
    a=QtWidgets.QApplication([''])
    # mystyle.darkStyle(True)
    a.setQuitOnLastWindowClosed(True)
    m=MainW()
    m.resize(1200,800)
    m.show()
    r=a.exec()
    sys.exit(r)
if __name__=="__main__":
    main()
    #testlink()